//
//  SectionGoodsCommentView.m
//  Lmm_IOS
//
//  Created by 张哲炜 on 2018/9/27.
//  Copyright © 2018年 lmm. All rights reserved.
//

#import "SectionGoodsCommentView.h"

@implementation SectionGoodsCommentView


- (void) initView: (int) count {
    [self setBackgroundColor:[UIColor whiteColor]];
    
    
    UIView *divideLine1 = UIView.new;
    divideLine1.backgroundColor = UIColorFromRGB(0xDDDDDD) ;
    [self addSubview:divideLine1];
    
    [divideLine1 makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.top).offset(0);
        make.left.equalTo(self.left).offset(0);
        make.right.equalTo(self.right).offset(0);
        make.height.equalTo(1/[[UIScreen mainScreen] scale]);
    }];
    
    UIView *divideView = UIView.new;
    divideView.backgroundColor = UIColorFromRGB(0xEEEEEE) ;
    [self addSubview:divideView];
    
    [divideView makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(divideLine1.bottom).offset(0);
        make.left.equalTo(self.left).offset(0);
        make.right.equalTo(self.right).offset(0);
        make.height.equalTo(10);
    }];
    
    UIView *divideLine2 = UIView.new;
    divideLine2.backgroundColor = UIColorFromRGB(0xDDDDDD) ;
    [self addSubview:divideLine2];
    
    [divideLine2 makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(divideView.bottom).offset(0);
        make.left.equalTo(self.left).offset(0);
        make.right.equalTo(self.right).offset(0);
        make.height.equalTo(1/[[UIScreen mainScreen] scale]);
    }];
    
    
    // 商品评价
    UILabel *goodsCommentDescLabel = UILabel.new;
    goodsCommentDescLabel.text = [NSString stringWithFormat:@"精彩评论(%d)", count] ;
    goodsCommentDescLabel.font = [UIFont fontWithName:MAIN_FONT_NAME size:16];
    goodsCommentDescLabel.textColor = SECOND_FONT_COLOR;
    goodsCommentDescLabel.numberOfLines = 1;
    //goodsCommentDescLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:goodsCommentDescLabel];
    
    [goodsCommentDescLabel makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(divideLine2.bottom).offset(0);
        //make.centerY.equalTo(self.centerY);
        make.height.equalTo(36);
        make.left.equalTo(self.left).offset(10);
        make.right.equalTo(self.right).offset(0);
    }];
    
        UIImageView *goViewIcon = UIImageView.new;
        goViewIcon.image = [UIImage imageNamed:@"go"];
        [self addSubview:goViewIcon];
    
        [goViewIcon makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(goodsCommentDescLabel.centerY);
            make.right.equalTo(self.right).offset(-10);
            make.width.equalTo(12);
            make.height.equalTo(22.5);
        }];
    
    UIView *divideLine = UIView.new;
    divideLine.backgroundColor = UIColorFromRGB(0xCCCCCC);
    [self addSubview:divideLine];
    
    [divideLine makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bottom).offset(0);
        make.left.equalTo(self.left).offset(10);
        make.right.equalTo(self.right).offset(0);
        make.height.equalTo(1/[[UIScreen mainScreen] scale]);
    }];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
